package com.example.demo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

@Controller
public class LoginController {

    @PostMapping(value = "/autoLogin")
    public String login(@RequestParam("username") String username,
                        @RequestParam("password") String password,
                        Map<String,Object> map){
        if ( !StringUtils.isEmpty(username)&&"123456".equals(password)) {
            map.put("Msg","登录成功！");
            return "redirect:/report";
        }else {
            map.put("Msg","用户名密码错误！");
            return "login";
        }
    }
}
